
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="handler.Manager" %>
<%@ page import="java.sql.SQLException" %>
<%@ page import="handler.Refresh" %>
<html>
<head>
    <title>添加授权码</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f0f0f0;
            padding: 20px;
            background-image: url("1.jpg");  /* 添加这行来引入背景图 */
            background-size: cover;  /* 使背景图充满整个容器 */
            background-repeat: no-repeat;  /* 不要重复背景图 */
        }
        form {
            margin-top: 20px;
        }
        label {
            display: block;
            margin-bottom: 10px;
        }
        input[type="text"], select {
            width: 200px;
            padding: 5px;
            font-size: 16px;
            border-radius: 5px;
            border: 1px solid #ccc;
        }
        button[type="button"] {
            padding: 10px 20px;
            font-size: 16px;
            color: white;
            background-color: #007BFF;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        #check {
            margin-top: 20px;
            font-weight: bold;
        }
    </style>
</head>
<body>
<div align="center">
    <form method="post">
        <label for="au">请输入授权码：</label>
        <input type="text" name="au" id="au">

        <label for="level">授权码等级：</label>
        <select name="level" id="level">
            <option value="0">免费</option>
            <option value="1">39元</option>
            <option value="2">99元</option>
        </select>
        <br>

        <button type="button" onclick="addAu()">添加</button>
    </form>
    <div id="check"></div>
</div>

<script>
    function addAu(){
        var xhr;
        if (window.XMLHttpRequest)
        {
            xhr=new XMLHttpRequest();
        }else{
            xhr=new ActiveXObject("Microsoft.XMLHTTP");
        }
        var au = document.getElementById("au").value;
        var level = document.getElementById("level").value;
        xhr.open("post","addAu",true);
        xhr.onreadystatechange=function() {
            if (xhr.readyState == xhr.DONE && xhr.status == 200) {
                document.getElementById("check").innerHTML = xhr.responseText;
            }
        }
        xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
        xhr.send("au="+au+"&level="+level);

    }
</script>
</body>
</html>